perimeterMax = 1000
map = {}
(1..perimeterMax).each do |a|
	(1..perimeterMax).each do |b|
		c = Math.sqrt((a ** 2) + (b ** 2))
		aBC = (a + b + c)
		if aBC <= perimeterMax && aBC.floor == aBC
			if map[aBC] != nil
				map[aBC] = map[aBC] + 1
			else
				map[aBC] = 1
			end
		end
	end
end

largestKey = 0
largestValue = 0
map.each do |key, value|
	if value > largestValue
		largestValue = value
		largestKey = key
	end
end

puts largestKey.to_s + " " + largestValue.to_s
